/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models.monorent;

import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import play.*;
import play.db.jpa.*;

import javax.persistence.*;
import java.util.*;

import models.*;

/**
 *
 * @author xuyuhang1005
 */
@Entity
public class RentInfo extends Model {
	public String name;
	
	public String location;
	public double lat;
	public double lng;
	
    public int price;
	public int bedroomCount;
	public int bathroomCount;
	public int petsAllowed;
	public int furnitured;
	
	@Lob
	public String description;
	
	@OneToMany(mappedBy="rentinfo", cascade=CascadeType.ALL)
	public List<RentInfoImage> images;
	
	public Date createDate;
	
	@ManyToOne
	public User owner;
	
	public RentInfo(Long uid, String name, String location, double lat, double lng, String desc, int price, int bedroomCount, int bathroomCount, int petsAllowed, int furnitured) {
		User u = User.findById(uid);
		this.name = name;
		this.location = location;
		this.createDate = new Date();
		this.lat = lat;
		this.lng = lng;
		this.owner = u;
		this.description = desc;
		
        this.price = price;
		this.bedroomCount = bedroomCount;
		this.bathroomCount = bathroomCount;
		this.petsAllowed = petsAllowed;
		this.furnitured = furnitured;
		
		this.images = new ArrayList<RentInfoImage>();
	}
}
